<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%  
	String path = request.getContextPath();  
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<script src="/bsc/static/js/jquery-3.1.1.js"></script>
<script src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

</head>
<body>

<!-- Button trigger modal -->


<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static">
  <div class="modal-dialog" role="document">
    <div class="modal-content" style="width: 800px">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">查看详情</h4>
      </div>
      <div class="modal-body">
        <table class="table table-bordered">
        	<tr>
        		<td>项目名称：</td>
        		<td>
        			<input type="text" name="project_name" id="project_name" placeholder="请输入项目名称"/>
        		</td>
        		<td>状态：</td>
        		<td>
        			<input type="text" name="status" id="status"/>
        			
        		</td>
	        </tr>
	        <tr>
        		<td>列表图片</td>
        		<td>
	        		<div style="width:100px; height:100px; border-radius:50%; overflow:hidden;">
						<img width="100px" height="100px" src="" id="cover_photo"/>
					</div>
        		 </td>
        		<td>封面图片</td>
        		<td>
        			<div style="width:100px; height:100px; border-radius:50%; overflow:hidden;">
						<img width="100px" height="100px" src="" id="cover_big_photo"/>
					</div>
        		</td>
        	</tr>
 			<tr>
 				<td>分类</td>
 				<td>
 					<input type="text" name="type_id" id="type_id"/>
 				</td>
 				<td>所用设备</td>
 				<td>
 					<input type="text" name="use_device" id="use_device"/>
 				</td>
 			</tr>
 			<tr>
 				<td>服务时长</td>
 				<td>
 					<input type="text" name="server_time" id="server_time"/>
 				</td>
 				<td>人民币售价</td>
 				<td>
 					<input type="text" name="rmb_price" id="rmb_price"/>
 				</td>
 			</tr>
 			<tr>
 				<td>颜值售价</td>
 				<td>
 					<input type="text" name="beauty_price" id="beauty_price"/>
 				</td>
 				<td>标准手工费</td>
 				<td>
 					<input type="text" name="manual_price" id="manual_price"/>
 				</td>
 			</tr>
 			<tr>
 				<td>活动手工费</td>
 				<td>
 					<input type="text" name="active_price" id="active_price"/>
 				</td>
 				<td>排序号</td>
 				<td>
 					<input type="text" name="sort_no" id="sort_no"/>
 				</td>
 			</tr>
 			<tr>
 				
 				<td>
 					内容描述
 				</td>
 				<td colspan="3">
 					<textarea rows="" cols="" name="content" id="content">
 						
 					</textarea>
 				</td>
 				
 			</tr>
 		
        	
        </table>
      </div>
      <div class="modal-footer">
        
        <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>

<form action="<%=basePath%>selectproject" method="post">
	<table align="center">
		<tr>
			<td>项目编号：</td>
			<td><input type="text" name="project_id"/></td>
			<td>项目名称：</td>
			<td><input type="text" name="project_name"/></td>
			
			<td rowspan="2" >
					<input type="submit" value="查询" /> 
					<input type="reset" value="重置" />
					<input type="button" value="添加"  onclick="insert()"> 
				
			</td>
		</tr>
				
		<tr>
		
			<td>分类：</td>
			<td>
				<select name="type_id">
								<option value="">-请选择-</option>
							<c:forEach items="${list2}" var="t">
									<option value="${t.type_id }">${t.type_name }</option>
							</c:forEach>
						</select>
			</td>
			<td>状态：</td>
			<td>
				<select name="status">
							<option value="">-请选择-</option>
							<option value="1">在售</option>
							<option value="2">下架</option>
					</select>
			</td>
		
		</tr>
	</table>
</form>
				
		<table  class="table table-bordered" >
			<tr>
				<td>项目编号</td>
				<td>项目名称</td>
				<td>分类</td>
				<td>服务时长（分钟）</td>
				<td>人民币售价（元）</td>
				<td>颜值售价（个）</td>
				<td>标准手工费（元）</td>
				<td>活动手工费（元）</td>
				<td>状态</td>
				<td>更新时间</td>
				<td>排序号</td>
				<td>操作</td>
			</tr>
			<c:forEach items="${list }" var="cx">
					<tr>
						<td>${cx.project_id }</td>
						<td>${cx.project_name }</td>
						<td>${cx.type_name }</td>
						<td>${cx.server_time }</td>
						<td>${cx.rmb_price }</td>
						<td>${cx.beauty_price }</td>
						<td>${cx.manual_price }</td>
						<td>${cx.active_price }</td>
						<td>${cx.status=='1'?'在售':'下架' }</td>
						<td>${cx.create_time }</td>
						<td>${cx.sort_no }</td>
						<td>
							
							<a href="<%=basePath%>delect/${cx.project_id}">删除</a> |
							<a href="<%=basePath%>updateByid/${cx.project_id}">修改</a> 
							<input type="button" value="查看详情"  onclick="selectByid(${cx.project_id})" />	
						</td>
					</tr>
			</c:forEach>
		</table>
</body>
</html>

<script>
function selectByid(id){
	//模态
	$.ajax({
		type:"post",
		url:"<%=basePath%>selectByid",
		data:{project_id:id},
		dataType:"json",
		success:function(msg){
			$("#project_name").val(msg.project_name);
			$("#status").val(msg.status);
			$("#cover_photo").prop("src","/bsc"+msg.cover_photo);
			$("#cover_big_photo").prop("src","/bsc"+msg.cover_big_photo);
			$("#type_id").val(msg.type_id);
			$("#use_device").val(msg.use_device);
			$("#server_time").val(msg.server_time);
			$("#rmb_price").val(msg.rmb_price);
			$("#beauty_price").val(msg.beauty_price);
			$("#manual_price").val(msg.manual_price);
			$("#active_price").val(msg.active_price);
			$("#sort_no").val(msg.sort_no);
			$("#content").val(msg.content);
		}
	})
	$("#myModal").modal("show");
	
}

	
var insert = function(){
	window.location.href="<%=basePath%>addtype";
	
}
</script>